<style>
    #app{
        /*
        font-family: Avenir,Helvetica,Arial,sans-serif;*/
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-align: center;
        color: #2c3e50;
        margin-top: 0;
        position: relative;
        height: 100%;
    }
</style>

<template>
    <div id="app">
        <router-view class="view"></router-view>
    </div>
</template>
<script>
    export default  {
        data(){
            return {
            }
        },
        created:function(){
            var _this=this;
            _this.isLogin();  //判断是否登录            
        },
        mounted:function(){
            var _this=this;
            // 每隔五分钟检查一下是否为登录状态
            setInterval(function(){
                _this.isLogin();  //判断是否登录
            },300000);
        },
        methods: {
            //判断是否登录
            isLogin(){
                var _this=this;
                $.ajax({
                    type: 'GET',
                    url: "http://127.0.0.1:18082/loginStatus",
                    cache: false,
                    success: function (data) {
                        if (data.success) {
                            if(data.data.loggedIn){
                                // _this.$router.push("/Main");
                            }else{
                                _this.$router.push("/");
                            }
                        }else {
                            _this.common.errorTip(data.errorMessage);
                        }
                    }
                });
            }
        }        
    }
</script>


